<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>如何返回介于 1 与 10 之间（都包括）的随机整数</title>
</head>

<body>
    <h2>JavaScript Math</h2>
    <p>Math.floor(Math.random() * 10) + 1) 返回 1 与 10 之间的随机整数（均包含）：</p>
    <p id="demo"></p>
    <script>
        document.getElementById("demo").innerHTML =
            Math.floor(Math.random() * 10) + 1;
    </script>
</body>

</html>